/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vehicle.resetpass;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import vehicle.bol.ResetPassword;

/**
 *
 * @author caodangtinh
 */
@ManagedBean
@SessionScoped
public class ResetPasswordBean {

    ResetPassword rp = new ResetPassword();
    String email;

    /** Creates a new instance of ResetPasswordBean */
    public ResetPasswordBean() {
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
    /*
     * Check Email
     */

    public String RPass() {
        boolean flag = rp.checkEmail(email);
        if (flag) {
            rp.sendRandomPass(email);
            rp.UpdatePass(email);
            return "resetsucess";
        } else {
            return "notfoundemail";
        }
    }
}
